package com.yimi.yinhepda.utils;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.yimi.yinhepda.R;

/**
 * 项目名称：ImageButtonWithText
 * 创建时间：2017/2/9 13:47
 * 版本号：1.0
 * 功能描述
 *
 * @author 刘宏恩
 */
public class ImageButtonLayout extends LinearLayout {
  private ImageView imageView;
  private TextView textView;

  public ImageButtonLayout(Context context) {
    this(context, null);
  }

  public ImageButtonLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    View rootView = LayoutInflater.from(context).inflate(R.layout.image_btn_item, this, true);
    imageView = (ImageView) rootView.findViewById(R.id.btn_img);
    textView = (TextView) rootView.findViewById(R.id.btn_text);
  }

  public void setImageView(int resId) {
    imageView.setImageResource(resId);
  }

  public void setTextViewText(String textViewText) {
    textView.setText(textViewText);
  }
}
